The concept of “caching” has been used in a number of computer-related applications to improve computer performance in a relatively cost-effective manner. Caching typically involves the temporary storage of data in a relatively fast memory in a computer to permit the quick retrieval of that data as it is needed by the computer.
A memory may constitute practically any device capable of storing data in a volatile or non-volatile manner on behalf of a computer or other data processing system, including registers, solid state devices such as RAM's or ROM's, and various magnetic and/or optically-readable storage media such as magnetic disks, magnetic tape, optical disks, etc. Different types of memory will generally have different relative speeds, costs, and capacities, and as a result, often a computer incorporates multiple types of memory to attempt to effectively balance cost with performance.
In general, the faster the memory, the greater cost of that memory, and the greater capacity constraints that exist on that memory. For example, one of the fastest memory technologies is achieved using static random access memory (SRAM) devices integrated onto the same chip as a microprocessor. However, due to limited space on a chip, SRAM capacity is often highly constrained. At the other extreme, magnetic and optical storage media often provide nearly unlimited capacity at a much lower overall cost, but at the expense of speed.
To better balance performance and cost, computers are typically designed with multiple types of memory arranged in a hierarchical fashion, with each successively-faster level of memory acting as a cache for the lower levels of memory in the computer. For example, a typical computer includes one or more levels of SRAM cache memories, a main storage including relatively slower and less expensive dynamic random access memories (DRAM's), and non-volatile or persistent storage including magnetic disk drives and other direct access storage devices (DASD's).
Many caches simply serve as repositories for data that is stored at a relatively lower level of memory in a computer, whereby the data stored in a cache is often identical to the data stored at the lower level of memory. Still other caches are constructed during the operation of a computer to assist in accessing other types of data stored in the computer, whereby the data stored in a cache may represent other types of data, but may not be an identical copy of such data. As an example, many types of storage media organize data into various files that are grouped together in a hierarchical structure of directories or folders. It has been found that, in some instances, it is desirable to cache the list of files and their hierarchical relationships on a storage medium to assist in performing file operations on a storage medium. The actual files are not cached, only the information that enables the computer to access those files on demand.
This type of cache, referred to herein as a directory cache, may be used for performing operations such as file searches, file existence checks, etc. In applications where a computer is required to find files meeting certain search parameters, or to verify whether certain files exist prior to retrieving those files, for example, being able to access a directory cache stored in relatively fast main storage, rather than by accessing the much-slower actual storage medium can provide tremendous performance improvements.
Given that there is typically some overhead associated with initially storing data in a cache (e.g., as the data typically must first be retrieved from a relatively slower memory), the benefits of caching are most prominent when cached data is reused multiple times. On the other hand, if cached data is only used once, caching that data may at best have only negligible benefit, and at worst, may actually decrease performance.
At best, cached data that is only used once will have no performance impact on a computer, particularly where storing data in a cache is performed in parallel with forwarding that data to the resource that originally requested that data. On the other hand, in some applications the cost of storing data in a cache may actually exceed the cost of simply retrieving the data without storing the data in a cache. In such applications, storing cached data that is never reused can actually decrease system performance.
In the case of directory caching, for example, there is always some degree of overhead required to build a cache of file information for a particular directory on a storage medium. The overhead is typically a result of the relatively slow access times of many types of storage media, e.g, optical disks. If cached directory information is reused in connection with a large number of file operations, such that the number of additional accesses to the storage medium is reduced, the savings often outweigh the cost of building the cache, thus improving the overall performance of the system. On the other hand, if only a few file operations are performed using cached directory information, the costs exceed the savings, thus decreasing system performance. In such instances, the “payback” of caching directory information may be insufficient to justify the costs.
Some cache-enabled applications support various mechanisms for disabling caching of potentially cacheable data. For example, some hardware designs support the ability to disable caching via hardware control to perform such functions as debugging a computer or computer program, or to prevent errors that might occur from attempting to cache certain ranges of memory addresses. Such hardware controls, however, are typically implemented for only narrow purposes, and are implemented for reasons other than improving system performance.
Still other designs permit caching of certain data to be disabled on a transaction-by-transaction basis. For example, an software application may be permitted to disable caching for certain types of data for which it is known will rarely if ever be reused. Also, certain requests for data from a storage medium may not be cached under certain circumstances particular to that request, e.g., where a current transfer rate for processing requests is above a certain threshold, or where a length of a data transfer is above a certain threshold. Such selective disabling of caching typically affects specific data transfers, and often requires that certain attributes of those data transfers be known beforehand.
In many applications, however, the potential payback of caching a particular piece of data may not be readily apparent from an analysis of any attribute of that data. For example, in the case of directory caching, it is difficult, if not impossible to determine whether it would be beneficial to build a cache of a given directory from an analysis of that directory. Therefore, a need continues to exist for a more flexible and broadly applicable manner of selectively and dynamically disabling caching in a computer to maximize system performance.